﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace IT_Pro.Class
{
    class NV_ChinhSachHeThong
    {
        private string _maNv;

        public string MaNv
        {
            get { return _maNv; }
            set { _maNv = value; }
        }
        private bool _guiMail;

        public bool GuiMail
        {
            get { return _guiMail; }
            set { _guiMail = value; }
        }
        private bool _usb;

        public bool Usb
        {
            get { return _usb; }
            set { _usb = value; }
        }
        private bool _internet;

        public bool Internet
        {
            get { return _internet; }
            set { _internet = value; }
        }
        private bool _yahoo;

        public bool Yahoo
        {
            get { return _yahoo; }
            set { _yahoo = value; }
        }
        private bool _skype;

        public bool Skype
        {
            get { return _skype; }
            set { _skype = value; }
        }
        private string _ghiChu;

        public string GhiChu
        {
            get { return _ghiChu; }
            set { _ghiChu = value; }
        }
        public static DataTable HienThiChinhSachofNhanVien(string manv)
        {
            string strSQL = "select * from NV_ChinhSachHeThong where MaNV='" + manv + "'";
            return DataServices.ExecQuery(strSQL);
        }

        public static bool ThemCS(NV_ChinhSachHeThong _cs)
        {           
           string   sql = "insert into NV_ChinhSachHeThong(MaNV,GuiMail,USB,Internet,Yahoo,Skype,GhiChu) values ('" + _cs.MaNv + "','" + _cs.GuiMail + "','" + _cs.Usb + "','" + _cs.Internet + "','" + _cs.Yahoo + "','" + _cs.Skype + "',N'"+_cs.GhiChu+"')";             
            DataServices.ExecNonQuery(sql);
            return true;
        }
        public static bool CapNhat(NV_ChinhSachHeThong _cs)
        {
           string sql = "update NV_ChinhSachHeThong Set GuiMail='" + _cs.GuiMail + "',USB='" + _cs.Usb + "',Internet='" + _cs.Internet + "',Yahoo='" + _cs.Yahoo + "',Skype='" + _cs.Skype + "',GhiChu='"+_cs.GhiChu+"' where MaNV='" + _cs.MaNv + "'";
           DataServices.ExecNonQuery(sql);
           return true;
        }
    }
}
